﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<script src="../../../../../../resources/plugin/jQuery-1.7.2.min.js" type="text/javascript"></script>
	<script>

		stateEscapes = function (state) {

			switch (state) {

				case 0:

					state = '正在运行';

					break;

				case 1:

					state = '隐藏';

					break;

			}

			return state;

		}

		timeEscaptes = function (date) {

			return date.getHours().toString().replace(/\b(\w)\b/g, '0$1') + ':' + date.getMinutes().toString().replace(/\b(\w)\b/g, '0$1') + ':' + date.getSeconds().toString().replace(/\b(\w)\b/g, '0$1');

		}

		runTimeEscaptes = function (date) {

			var nowDate = new Date();

			var diff = new Date(nowDate - date - 28800000);

			return timeEscaptes(diff);

		}

		autoShow = function () {

			$('#domList tr:[class=domList-list]').remove();
			
			var domList = top.$.jLayer.domList;

			var id, name, startTime, runTime, state;

			for (var val in domList) {

				id = val;

				name = domList[val].config.title;

				startTime = timeEscaptes(domList[val].startTime);

				runTime = runTimeEscaptes(domList[val].startTime);

				state = stateEscapes(domList[val].state);

				$('#domList').append('<tr class="domList-list"><td class="process-tit" title="' + id + '">' + id + '</td><td title="' + name + '">' + name + '</td><td title="' + startTime + '">' + startTime + '</td><td title="' + runTime + '">' + runTime + '</td><td title="' + state + '">' + state + '</td></tr>');

			}

			setTimeout(autoShow, 1000);

		}

		$(document).ready(

			function () {

				autoShow();

			}

		);
	</script>
	<style>
		body{font-size:12px;margin:0;}
		#domList{table-layout:fixed;width:100%;}
		#domList tr td{white-space:nowrap;overflow:hidden;padding:5px;text-align:center;}
		.domList-head{font-weight:bold;color:#666;}
		.domList-head td{border-bottom:solid 1px #ccc;}
		.domList-list:hover td{background:#eee;}
		.process-tit{color:#090;font-weight:bold;}
	</style>
</head>
<body>
	<table id="domList">

		<tr class="domList-head">
			<td>进程名称</td>
			<td>任务名称</td>
			<td>开始时间</td>
			<td>运行时间</td>
			<td>状态</td>
		</tr>

	</table>
</body>
</html>